﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Jungle.Code.BLL;
using Jungle.Code.Utils;
using System.Collections.Generic;
using Jungle.Code.DAL;
using System.Data.SqlClient;

	public partial class admin :   BaseAdminModule
	{
        string cmd = "";
		protected void Page_Load(object sender, EventArgs e)
		{
            umMenu.Visible = true;
            umMenu.ActiveViewIndex = 0;

            cmd = Request["cmd"];
            switch (cmd)
            {
                case "delete":
                    delForm.Visible = true;
                    break;
                case "more":
                    umMenu.ActiveViewIndex = 0;
                    break;
            } 

		}
        public override void FillBaseInfo()
        {
            sysName = "UserManager";
        }
        public override void Main()
        {
        }

        protected void yesDel(object sender, EventArgs e)
        {
            SqlConnection lCon = new SqlConnection(DBHelper.ConnectionString);
            SqlCommand del_data = new SqlCommand("mdUsers_DelById", lCon);
            del_data.CommandType = CommandType.StoredProcedure;

            SqlParameter param_id_field = del_data.Parameters.Add("@id_user", SqlDbType.Int);
            param_id_field.Value = Convert.ToInt32(Request["id_user"]);

            del_data.Connection.Open();
            del_data.ExecuteNonQuery();
            del_data.Connection.Close();

            Response.Redirect("~/admin/Users.aspx");
        }

        protected void noDel(object sender, EventArgs e)
        {
            Response.Redirect("~/Admin/Users.aspx?cmd=more&id_user=" + Request["id_user"].ToString());
        }
	}
